<!--
  - Copyright 2011 Angel Sanadinov
  -
  - This file is part of VBox WMI.
  -
  - VBox WMI is free software: you can redistribute it and/or modify
  - it under the terms of the GNU General Public License as published by
  - the Free Software Foundation, either version 3 of the License, or
  - (at your option) any later version.
  -
  - VBox WMI is distributed in the hope that it will be useful,
  - but WITHOUT ANY WARRANTY; without even the implied warranty of
  - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  - GNU General Public License for more details.
  -
  - You should have received a copy of the GNU General Public License
  - along with VBox WMI.  If not, see <http://www.gnu.org/licenses/>.
  -->

<%@tag import="Utilities.Constants"%>
<%@tag import="Utilities.ParameterNames"%>
<%@tag import="Managers.Utilities.ResponseMessagesContainer"%>
<%@tag import="Managers.Utilities.User"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="jstlc"%>
<%@tag description="put the tag description here" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>

<%-- Attributes --%>
<%@attribute name="pageName" required="true" description="Page title."
             rtexprvalue="true" type="java.lang.String"%>

<%@attribute name="pageId" required="true" 
             description="Page ID (for highlighting the current page on the navigation bar)."
             rtexprvalue="true" type="java.lang.String"%>

<%@attribute name="userSessionData" required="true" description="The current user's session data."
             rtexprvalue="true" type="Managers.Utilities.User"%>

<%@attribute name="additionalMetaData" required="false" description="Additional meta data tags."
             rtexprvalue="true" type="java.lang.String"%>

<%@attribute name="additionalScriptsData" required="false" description="Additional scripts for the page."
             rtexprvalue="true" type="java.lang.String"%>

<jstlc:set var="messagesContainer" value="<%= (ResponseMessagesContainer)request.getSession(false).getAttribute(ParameterNames.SESSION_REQUEST_MESSAGES_OBJECT) %>"/>
<%-- End of Attributes --%>

<%-- Page Header Content --%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/mainStyles.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        ${additionalMetaData}
        <title>${pageName}</title>
        <script type="text/javascript" src="js/elementsNavigation.js"></script>
        ${additionalScriptsData}
    </head>
    <body>
        <jstlc:set var="disable" value="class=\"disabledNavigationButton\" onclick=\"return false;\" title=\"Select a server first\""/>
        <ul class="navigationBar">
            <li ${pageId == "pageHome" ? "id=\"current\"" : ""}><a  href="index.jsp">Home</a></li>
            <li ${pageId == "pageServers" ? "id=\"current\"" : ""}><a href="servers.jsp">Servers</a></li>
            <li ${pageId == "pageMedia" ? "id=\"current\"" : ""}><a href="media.jsp" ${(userSessionData.currentServerId > 0) ? "" : disable}>Media</a></li>
            <li ${pageId == "pageMachines" ? "id=\"current\"" : ""}><a href="machines.jsp" ${(userSessionData.currentServerId > 0) ? "" : disable}>Machines</a></li>
            <li ${pageId == "pageNetworks" ? "id=\"current\"" : ""}><a href="networks.jsp" ${(userSessionData.currentServerId > 0) ? "" : disable}>Networks</a></li>
            <jstlc:if test="<%= userSessionData.getUserData().getAccountLevel() >= Constants.DB_USER_ACCOUNT_LEVEL_MANAGER %>">
            <li ${pageId == "pageUsers" ? "id=\"current\"" : ""}><a href="users.jsp">Users</a></li>
            </jstlc:if>
            <li ${pageId == "pageLogs" ? "id=\"current\"" : ""}><a href="logs.jsp">Logs</a></li>
            <li><a href="users.jsp?id=${userSessionData.userData.userId}">Account</a></li>
            <li><a id="currentServer" onclick="return false;">Current Server: <b>${(userSessionData.currentServerId > 0) ? userSessionData.currentServerId : "none"}</b></a></li>
            <li ${pageId == "pageErrors" ? "id=\"current\"" : ""}><a ${(messagesContainer.numberOfNewMessages > 0) ? "id=\"errorButton\"" : ""} href="errorMessages.jsp" >Messages</a></li>
            <li ${pageId == "webRDP" ? "id=\"current\"" : ""}><a href="webRDP.jsp" ${(userSessionData.currentServerId > 0) ? "" : disable}>Web RDP</a></li>
            <li><a id="logoutButton" href="logout.jsp">Logout</a></li>
        </ul>
        <div id="opaqueLayer"></div>
        <div id="contentPane">
<%-- End of Page Header Content --%>